package com.eattravel.enums;

/**
 * @author glong
 * @date 2019/9/19 22:18
 * 描述：枚举类，
 */
public enum StoreStateEnum {
    CHECK(0,"审核中"),OFFLINE(-1,"非法店铺"),
    SUCCESS(1,"操作成功"), PASS(2,"通过认证"),
    INNER_ERROR(-1001,"内部系统错误"),NULL_STOREID(-1002,"StoreId为空");

    private int state;
    private String stateInfo;

    private StoreStateEnum(int state, String stateInfo){
        this.state = state;
        this.stateInfo = stateInfo;
    }


    public int getState() {
        return state;
    }

    public String getStateInfo() {
        return stateInfo;
    }

    /**
     * 依据传入的state返回相应的enum值
     */
    public static StoreStateEnum stateOf(int state){
        for (StoreStateEnum storeSateEnum: values()){
            if(storeSateEnum.getState() == state){
                return storeSateEnum;
            }
        }
        return null;
    }


}
